From 55fcb979e125639da4839beb264e8520d387d135 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 2 Mar 2007 16:29:48 +0000 Subject: [PATCH] linux: xenbus dev write function resets packet data on *all* error conditions. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c index f9c1801e1a..a1e56ddb8d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c @@ -175,11 +175,15 @@ static ssize_t xenbus_dev_write(struct file *filp, struct watch_adapter *watch, *tmp_watch; int err, rc = len; - if ((len + u->len) > sizeof(u->u.buffer)) - return -EINVAL; + if ((len + u->len) > sizeof(u->u.buffer)) { + rc = -EINVAL; + goto out; + } - if (copy_from_user(u->u.buffer + u->len, ubuf, len) != 0) - return -EFAULT; + if (copy_from_user(u->u.buffer + u->len, ubuf, len) != 0) { + rc = -EFAULT; + goto out; + } u->len += len; if ((u->len < sizeof(u->u.msg)) || -- 2.30.2